<template>
  <div class="wrap">
    <div class="noData">
      <img src="./../../assets/img/noData.png" alt="" />
      <div class="txt">暂无入场纪录</div>
    </div>
  </div>
</template>

<script setup>
import { onMounted, ref, watch } from 'vue'
import wx from 'weixin-js-sdk'
import { postData } from '@/request/request.js'
import { useRoute } from 'vue-router/dist/vue-router'
import defaultPic from '@/assets/img/default-pic.png'
const route = useRoute()

const carriedUserid = ref('')
let info = ref({})

const GetRequest = () => {
  var url = window.location.href //获取url中"?"符后的字串
  var theRequest = new Object()
  let index = url.indexOf('?')
  if (index != -1) {
    var str = url.substring(index)
    let strs = str.split('&')
    for (var i = 0; i < strs.length; i++) {
      theRequest[strs[i].split('=')[0]] = unescape(strs[i].split('=')[1])
    }
  }
  return theRequest
}

let initInfo = () => {
  postData('/user/carried/info', {
    carried_user_id: carriedUserid.value,
    with_health: 1,
  }).then((res) => {
    info.value = res.datas
  })
}

const goHref = (txt) => {
  if (txt == 'updateCarried') {
    wx &&
      wx.miniProgram.navigateTo({
        url: `/pagesC/carryUserUpdate/carryUserUpdate?id=${carriedUserid.value}`,
      })
  } else if (txt == 'healthCard') {
    wx &&
      wx.miniProgram.navigateTo({
        url: `/pagesC/healthCard/healthCard?id=${carriedUserid.value}`,
      })
  } else if (txt == 'facephoto') {
    //跳到h5-人脸页面
    // https://ya30wxmp.hbwlife.com/myInfo.html#/userFacephoto
    //要跳转到这个页面，还是得需要小程序有它的页面啊
    wx &&
      wx.miniProgram.navigateTo({
        url: `/pagesC/userFacephoto/index?id=${carriedUserid.value}`,
      })
  }
}

onMounted(() => {
  var Request = GetRequest()
  let id = Request['id'] || ''
  carriedUserid.value = id
  initInfo()
})

watch(
  () => route.fullPath,
  () => {
    var Request = GetRequest()
    let id = Request['id'] || ''
    carriedUserid.value = id
    initInfo()
  }
)
</script>

<style scoped>
.wrap {
  width: 100%;
  height: 100vh;
  overflow-y: auto;
  background: #f7f7f8;
}
.noData {
  display: flex;
  flex-flow: column;
  justify-content: flex-start;
  align-items: center;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}
.noData img {
  width: 0.6rem;
  height: 0.6rem;
}
.noData .txt {
  margin-top: 0.1rem;
  font-size: 0.14rem;
  color: #8d8f91;
}
</style>
